/**
 Copyright will be fixed soon.
 Author: Hiroshi Ota.
 $Date: $
 $Revision: $
*/

/**
 Copyright will be fixed soon.
 Author: Hiroshi Ota.
 $Date: $
 $Revision: $
*/

#include "BFArgorithmContainer.h"

#ifdef _BRICKOS_
#include "stdlib.h"
#endif

BFArgorithmContainer::BFArgorithmContainer()
:	strategy(0),
	noOfPathRecognizer(0),
	maxOfPathRecognizer(0),
	pathRecognizers(0),
	noOfDriveControl(0),
	maxOfDriveControl(0),
	driveControls(0)
{
	;
}

BFArgorithmContainer::BFArgorithmContainer(int noOfPathRecognizer, int noOfDriveControl)
:	strategy(0),
	noOfPathRecognizer(0),
	maxOfPathRecognizer(noOfPathRecognizer),
	pathRecognizers(0),
	noOfDriveControl(0),
	maxOfDriveControl(noOfDriveControl),
	driveControls(0)
{
	pathRecognizers = new BFPathRecognizer*[maxOfPathRecognizer];
	driveControls = new BFDriveControl*[maxOfDriveControl];
}

BFArgorithmContainer::~BFArgorithmContainer(void)
{
	delete [] pathRecognizers;
	delete [] driveControls;
}

void BFArgorithmContainer::updateContainerSize(int noOfPathRecognizer, int noOfDriveControl)
{
	if (pathRecognizers!=0){
		delete [] pathRecognizers;
	}
	if (driveControls!=0){
		delete [] driveControls;
	}

	maxOfPathRecognizer = noOfPathRecognizer;
	maxOfDriveControl = noOfDriveControl;

	pathRecognizers = new BFPathRecognizer*[maxOfPathRecognizer];
	for (int i=0;i<maxOfPathRecognizer;i++) {
		pathRecognizers[i]=0;
	}
	driveControls = new BFDriveControl*[maxOfDriveControl];
	for (int i=0;i<maxOfDriveControl;i++){
		driveControls[i]=0;
	}
}
